<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>多彩主题背景切换</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Arial', sans-serif;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            transition: background 0.5s ease, color 0.3s ease;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
        }

        .container {
            text-align: center;
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            border-radius: 20px;
            padding: 40px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            max-width: 600px;
            width: 90%;
        }

        h1 {
            font-size: 2.5rem;
            margin-bottom: 20px;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
        }

        .subtitle {
            font-size: 1.2rem;
            margin-bottom: 30px;
            opacity: 0.9;
        }

        .theme-buttons {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
            gap: 15px;
            margin-top: 30px;
        }

        .theme-btn {
            padding: 15px 20px;
            border: none;
            border-radius: 10px;
            font-size: 1rem;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            background: rgba(255, 255, 255, 0.2);
            color: white;
            backdrop-filter: blur(5px);
            border: 1px solid rgba(255, 255, 255, 0.3);
        }

        .theme-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
            background: rgba(255, 255, 255, 0.3);
        }

        .theme-btn:active {
            transform: translateY(-1px);
        }

        /* 主题样式 */
        .theme-purple {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }

        .theme-sunset {
            background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
        }

        .theme-ocean {
            background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
        }

        .theme-forest {
            background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
        }

        .theme-candy {
            background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
        }

        .theme-night {
            background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
        }

        .theme-fire {
            background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
        }

        .theme-aurora {
            background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
        }

        .random-btn {
            background: rgba(255, 255, 255, 0.25);
            margin-top: 20px;
            width: 100%;
            font-size: 1.1rem;
        }

        .color-info {
            margin-top: 20px;
            padding: 15px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 10px;
            font-family: 'Courier New', monospace;
            font-size: 0.9rem;
        }

        @media (max-width: 600px) {
            h1 {
                font-size: 2rem;
            }
            
            .theme-buttons {
                grid-template-columns: repeat(2, 1fr);
            }
        }
    </style>
</head>
<body class="theme-purple">
    <div class="container">
        <h1>🎨 多彩主题切换器</h1>
        <p class="subtitle">点击下方按钮切换不同的主题背景</p>
        
        <div class="theme-buttons">
            <button class="theme-btn" onclick="changeTheme('theme-purple')">紫罗兰</button>
            <button class="theme-btn" onclick="changeTheme('theme-sunset')">日落</button>
            <button class="theme-btn" onclick="changeTheme('theme-ocean')">海洋</button>
            <button class="theme-btn" onclick="changeTheme('theme-forest')">森林</button>
            <button class="theme-btn" onclick="changeTheme('theme-candy')">糖果</button>
            <button class="theme-btn" onclick="changeTheme('theme-night')">夜晚</button>
            <button class="theme-btn" onclick="changeTheme('theme-fire')">火焰</button>
            <button class="theme-btn" onclick="changeTheme('theme-aurora')">极光</button>
        </div>
        
        <button class="theme-btn random-btn" onclick="randomTheme()">🎲 随机主题</button>
        
        <div class="color-info" id="colorInfo">
            当前主题：紫罗兰主题
        </div>
    </div>

    <script>
        const themes = [
            'theme-purple',
            'theme-sunset', 
            'theme-ocean',
            'theme-forest',
            'theme-candy',
            'theme-night',
            'theme-fire',
            'theme-aurora'
        ];

        const themeNames = {
            'theme-purple': '紫罗兰主题',
            'theme-sunset': '日落主题',
            'theme-ocean': '海洋主题',
            'theme-forest': '森林主题',
            'theme-candy': '糖果主题',
            'theme-night': '夜晚主题',
            'theme-fire': '火焰主题',
            'theme-aurora': '极光主题'
        };

        function changeTheme(themeName) {
            // 移除所有主题类
            document.body.className = '';
            // 添加新主题类
            document.body.classList.add(themeName);
            
            // 更新颜色信息
            document.getElementById('colorInfo').textContent = `当前主题：${themeNames[themeName]}`;
            
            // 保存到本地存储
            localStorage.setItem('selectedTheme', themeName);
        }

        function randomTheme() {
            const randomIndex = Math.floor(Math.random() * themes.length);
            const randomThemeName = themes[randomIndex];
            changeTheme(randomThemeName);
        }

        // 页面加载时恢复上次选择的主题
        window.addEventListener('DOMContentLoaded', function() {
            const savedTheme = localStorage.getItem('selectedTheme');
            if (savedTheme && themes.includes(savedTheme)) {
                changeTheme(savedTheme);
            }
        });

        // 添加键盘快捷键支持
        document.addEventListener('keydown', function(e) {
            if (e.key >= '1' && e.key <= '8') {
                const index = parseInt(e.key) - 1;
                if (index < themes.length) {
                    changeTheme(themes[index]);
                }
            } else if (e.key === 'r' || e.key === 'R') {
                randomTheme();
            }
        });
    </script>
</body>
</html>